package mx.com.matersys.vacs.daos;

import java.lang.Integer;
import java.lang.Long;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PersistenceContext;
import javax.persistence.Version;
import mx.com.matersys.vacs.domain.Roles;
import org.springframework.transaction.annotation.Transactional;

privileged aspect RolesDAO {
 
 declare @type: Roles: @Entity;
 
 @PersistenceContext
 transient EntityManager Roles.entityManager;
 
 @Id
 @GeneratedValue(strategy = GenerationType.AUTO)
 @Column(name = "id")
 
 private Long Roles.id;
 
 @Version
 @Column(name = "version")
 private Integer Roles.version;
 
 public Long Roles.getId() {
     return this.id;
 }
 
 public void Roles.setId(Long id) {
     this.id = id;
 }
 
 public Integer Roles.getVersion() {
     return this.version;
 }
 
 public void Roles.setVersion(Integer version) {
     this.version = version;
 }
 
 @Transactional
 public void Roles.persist() {
     if (this.entityManager == null) this.entityManager = entityManager();
     this.entityManager.persist(this);
 }
 
 @Transactional
 public void Roles.remove() {
     if (this.entityManager == null) this.entityManager = entityManager();
     if (this.entityManager.contains(this)) {
         this.entityManager.remove(this);
     } else {
         Roles attached = Roles.findRoles(this.id);
         this.entityManager.remove(attached);
     }
 }
 
 @Transactional
 public void Roles.flush() {
     if (this.entityManager == null) this.entityManager = entityManager();
     this.entityManager.flush();
 }
 
 @Transactional
 public void Roles.clear() {
     if (this.entityManager == null) this.entityManager = entityManager();
     this.entityManager.clear();
 }
 
 @Transactional
 public Roles Roles.merge() {
     if (this.entityManager == null) this.entityManager = entityManager();
     Roles merged = this.entityManager.merge(this);
     this.entityManager.flush();
     return merged;
 }
 
 public static final EntityManager Roles.entityManager() {
     EntityManager em = new Roles().entityManager;
     if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
     return em;
 }
 
 public static long Roles.countRoleses() {
     return entityManager().createQuery("SELECT COUNT(o) FROM Roles o", Long.class).getSingleResult();
 }
 
 public static List<Roles> Roles.findAllRoleses() {
     return entityManager().createQuery("SELECT o FROM Roles o", Roles.class).getResultList();
 }
 
 public static Roles Roles.findRoles(Long id) {
     if (id == null) return null;
     return entityManager().find(Roles.class, id);
 }
 
 public static List<Roles> Roles.findRolesEntries(int firstResult, int maxResults) {
     return entityManager().createQuery("SELECT o FROM Roles o", Roles.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
 }
 
}
